import { ColumnProps } from "@/components/Table/type";
import { SchemaProps } from "@/components/Form/type";
export const columns: ColumnProps[] = [
  { type: "index", label: "#", width: 50 },
  { prop: "clientKey", label: "客户端公钥" },
  { prop: "clientSecret", label: "客户端秘钥" },
  { prop: "deviceType", label: "设备类型", search: { el: "input" } },
  { prop: "activeTimeout", label: "活跃超时时间", width: 150 },
  { prop: "timeout", label: "固定超时时间", width: 150 },
  { prop: "action", label: "操作", width: 150, fixed: "right" }
];

export const schemas: SchemaProps[] = [
  {
    field: "clientKey",
    label: "客户端公钥",
    required: true,
    disabled: row => {
      return !!row.id;
    }
  },
  {
    field: "clientSecret",
    label: "客户端公钥",
    required: true,
    disabled: row => {
      return !!row.id;
    }
  },
  { field: "deviceType", label: "设备类型", required: true },
  {
    field: "activeTimeout",
    label: "活跃超时",
    el: "number",
    elProps: {
      controlsPosition: "right",
      precision: 0,
      style: {
        width: "100%"
      }
    },
    defaultValue: 1800,
    required: true
  },
  {
    field: "timeout",
    label: "固定超时",
    el: "number",
    elProps: {
      controlsPosition: "right",
      precision: 0,
      style: {
        width: "100%"
      }
    },
    defaultValue: 604800,
    required: true
  }
];
